﻿#region

using System;
using System.Collections.Generic;
using System.Linq;
using CommonBehaviors.Actions;
using Styx;
using Styx.CommonBot;
using Styx.TreeSharp;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using Action = Styx.TreeSharp.Action;

#endregion

namespace TheFinalCall.Druid
{
    public class Feral
    {
        public delegate IEnumerable<WoWUnit> EnumWoWUnitDelegate(object context);

        public static WoWUnit a;
        public static double b;

        //general variables
        private static double? _rake_tick_multiplier;
        private static double? _rip_tick_multiplier;
        private static double? _rip_remains;
        private static double? _combo_points;
        private static double? _energy;
        private static double? _time_to_max;
        private static double? _EnergyRegen;
        private static double? _cast_time;

        //Debuff
        public static double? _debuff_weakened_armor_stack;

        //target
        public static double? _time_to_die;
        public static double? _pct;

        //Cooldown
        public static double? _cooldown_berserk_remains;
        public static double? _cooldown_tigers_fury_remains;

        //Dot
        public static double? _dot_rake_remains;
        public static bool? _dot_rip_ticking;
        public static double? _dot_rip_remains;
        public static double? _dot_thrash_cat_remains;

        //Buff
        public static bool? _buff_berserk_up;
        public static bool? _buff_berserk_down;
        public static double? _buff_berserk_remains;
        public static bool? _buff_cat_form_down;
        public static bool? _buff_dream_of_cenarius_damage_down;
        public static bool? _buff_dream_of_cenarius_damage_up;
        public static double? _buff_dream_of_cenarius_damage_stack;
        public static double? _buff_heart_of_the_wild_remains;
        public static bool? _buff_heart_of_the_wild_up;
        public static bool? _buff_king_of_the_jungle_up;
        public static bool? _buff_king_of_the_jungle_down;
        public static bool? _buff_natures_swiftness_up;
        public static bool? _buff_natures_vigil_up;
        public static bool? _buff_omen_of_clarity_react;
        public static bool? _buff_predatory_swiftness_up;
        public static bool? _buff_predatory_swiftness_down;
        public static double? _buff_predatory_swiftness_remains;
        public static double? _buff_savage_roar_remains;
        public static bool? _buff_savage_roar_down;
        public static bool? _buff_savage_roar_up;
        public static bool? _buff_tigers_fury_up;
        public static bool? _buff_virmens_bite_potion_up;

        //This values will not be resetted. Its managed by combatlogger.
        public static double _ExtendedRip;
        public static double _dot_rake_multiplier;
        public static double _dot_rip_multiplier;
        private static IEnumerable<WoWUnit> _aoeColl;

        private static LocalPlayer Me
        {
            get { return StyxWoW.Me; }
        }

        private static DateTime SuppressShapeshiftUntil
        {
            get { return EventHandlers.LastShapeshiftError.AddSeconds(60); }
        }

        private static bool RecentShapeshiftErrorOccurred
        {
            get { return SuppressShapeshiftUntil > DateTime.Now; }
        }


        protected static double rip_tick_multiplier
        {
            get
            {
                if (!_rip_tick_multiplier.HasValue)
                {
                    _rip_tick_multiplier = (113 + (320*combo_points) +
                                            (0.3872*StyxWoW.Me.AttackPower*combo_points))*
                                           Common.DamageMultiplier();
                    _rip_tick_multiplier = _rip_tick_multiplier*
                                           (1 + Lua.GetReturnVal<float>("return GetMasteryEffect()", 0)/100);
                    return _rip_tick_multiplier.Value;
                }
                return _rip_tick_multiplier.Value;
            }
        }

        protected static double rake_tick_multiplier
        {
            get
            {
                if (!_rake_tick_multiplier.HasValue)
                {
                    _rake_tick_multiplier = (118 + (StyxWoW.Me.AttackPower*0.368))*Common.DamageMultiplier();
                    _rake_tick_multiplier = _rake_tick_multiplier*
                                            (1 + Lua.GetReturnVal<float>("return GetMasteryEffect()", 0)/100);
                    return _rake_tick_multiplier.Value;
                }
                return _rake_tick_multiplier.Value;
            }
        }

        protected static double rip_remains
        {
            get
            {
                if (!_rip_remains.HasValue)
                {
                    if (!StyxWoW.Me.CurrentTarget.HasMyAura("Rip"))
                    {
                        _rip_remains = 0;
                        return _rip_remains.Value;
                    }
                    if (ExtendedRip <= 2)
                        _rip_remains = (dot.rip.remains + (6 - (ExtendedRip*2)));
                    if (ExtendedRip > 2)
                        _rip_remains = (dot.rip.remains);
                    return _rip_remains != null ? _rip_remains.Value : 0;
                }
                return _rip_remains.Value;
            }
        }

        protected static double ExtendedRip
        {
            get { return _ExtendedRip; }
        }

        public static double combo_points
        {
            get
            {
                if (!_combo_points.HasValue)
                {
                    _combo_points = StyxWoW.Me.ComboPoints;
                    return _combo_points.Value;
                }
                return _combo_points.Value;
            }
        }

        protected static double energy
        {
            get
            {
                if (!_energy.HasValue)
                {
                    _energy = Lua.GetReturnVal<int>("return UnitPower(\"player\");", 0);
                    return _energy.Value;
                }
                return _energy.Value;
            }
        }

        protected static double EnergyRegen
        {
            get
            {
                if (!_EnergyRegen.HasValue)
                {
                    _EnergyRegen = Lua.GetReturnVal<float>("return GetPowerRegen()", 1);
                    return _EnergyRegen.Value;
                }
                return _EnergyRegen.Value;
            }
        }

        protected static double time_to_max
        {
            get
            {
                if (!_time_to_max.HasValue)
                {
                    _time_to_max = (100 - energy)*(1.0/EnergyRegen);
                    return _time_to_max.Value;
                }
                return _time_to_max.Value;
            }
        }

        protected static double cast_time
        {
            get
            {
                if (!_cast_time.HasValue)
                {
                    _cast_time = SpellManager.Spells["Wrath"].CastTime*0.001;
                    return _cast_time.Value;
                }
                return _cast_time.Value;
            }
        }

        #region Common

        [Behavior(BehaviorType.Rest, WoWClass.Druid, WoWSpec.DruidFeral, WoWContext.All, 1)]
        public static Composite CreateFeralDruidRest()
        {
            return new PrioritySelector(
                Spell.WaitForCast(),
                new Decorator(
                    ret => !Spell.IsGlobalCooldown(),
                    new PrioritySelector(
                        new Throttle(10,
                                     new Decorator(
                                         ret => SpellManager.HasSpell("Savage Roar")
                                                && Me.RawComboPoints > 0
                                                && Me.ComboPointsTarget != 0
                                                && null != ObjectManager.GetObjectByGuid<WoWUnit>(Me.ComboPointsTarget)
                                                &&
                                                Me.GetAuraTimeLeft("Savage Roar", true).TotalSeconds <
                                                (Me.RawComboPoints*6 + 6),
                                         new Sequence(
                                             new Action(
                                                 r =>
                                                 Logger.WriteDebug(
                                                     "cast Savage Roar to use {0} points on corpse of {1} since buff has {2} seconds left",
                                                     Me.RawComboPoints,
                                                     ObjectManager.GetObjectByGuid<WoWUnit>(Me.ComboPointsTarget)
                                                                  .SafeName(),
                                                     Me.GetAuraTimeLeft("Savage Roar", true).TotalSeconds)),
                                             Spell.Cast("Savage Roar",
                                                        on =>
                                                        ObjectManager.GetObjectByGuid<WoWUnit>(Me.ComboPointsTarget))
                                             )
                                         )
                            ),
                        Common.CreateProwlBehavior(ret => Me.HasAura("Drink") || Me.HasAura("Food")),
                        new Decorator(
                            ret => !Me.HasAura("Drink") && !Me.HasAura("Food")
                                   && Me.HasAura("Predatory Swiftness")
                                   &&
                                   (Me.GetPredictedHealthPercent(true) < 95 ||
                                    (Common.HasTalent(DruidTalents.DreamOfCenarius) &&
                                     !Me.HasAuraExpired("Dream of Cenarius"))),
                            new PrioritySelector(
                                new Action(r =>
                                    {
                                        Logger.WriteDebug("Druid Rest Swift Heal @ {0:F1}% and moving:{1} in form:{2}",
                                                          Me.HealthPercent, Me.IsMoving, Me.Shapeshift);
                                        return RunStatus.Failure;
                                    }),
                                Spell.Cast("Healing Touch",
                                           mov => true,
                                           on => Me,
                                           req => true,
                                           cancel => false)
                                )
                            )

                        // remainder of rest behavior in common
                        )
                    )
                );
        }

        [Behavior(BehaviorType.Pull, WoWClass.Druid, WoWSpec.DruidFeral, WoWContext.All)]
        public static Composite CreateFeralNormalPull()
        {
            return new PrioritySelector(
                Safers.EnsureTarget(),
                Movement.CreateFaceTargetBehavior(),
                Movement.CreateMoveToLosBehavior(),
                Common.CreateDismount("Pulling"),
                Common.CreateAutoAttack(false),
                Common.CreateDismount("Pulling"),
                Spell.WaitForCast(),
                new Decorator(
                    ret => !Spell.IsGlobalCooldown(),
                    new PrioritySelector(
                        //Shoot flying targets
                        new Decorator(
                            ret => Me.CurrentTarget.IsAboveTheGround(),
                            new PrioritySelector(
                                Spell.Buff("Faerie Fire", ret => Me.CurrentTarget.Distance < 35),
                                Spell.Cast("Moonfire", ret => Me.CurrentTarget.Distance < 40),
                                Movement.CreateMoveToTargetBehavior(true, 27f)
                                )),
                        Spell.BuffSelf("Cat Form"),
                        Spell.BuffSelf("Prowl", ret => !Me.Combat),
                        // save WC for later if Dash is active. also throttle to deal with possible pathing issues
                        new Throttle(7,
                                     Spell.Cast("Wild Charge",
                                                ret => MovementManager.IsClassMovementAllowed && !Me.HasAura("Dash"))),
                        // only Dash if we dont have WC or WC was cast more than 2 seconds ago
                        Spell.BuffSelf("Dash",
                                       ret => MovementManager.IsClassMovementAllowed
                                              && Me.IsMoving
                                              && Me.HasAura("Prowl")
                                              && Me.GotTarget && Me.CurrentTarget.Distance > 15
                                              &&
                                              (!SpellManager.HasSpell("Wild Charge") ||
                                               Spell.GetSpellCooldown("Wild Charge").TotalSeconds < 13)),
                        Spell.Cast("Pounce", ret => Me.HasAura("Prowl") && Me.CurrentTarget.IsWithinMeleeRange),
                        Spell.Buff("Rake", ret => Me.CurrentTarget.IsWithinMeleeRange),
                        Spell.Cast("Mangle", ret => Me.CurrentTarget.IsWithinMeleeRange)
                        )
                    ),
                // Move to Melee
                Movement.CreateMoveToMeleeBehavior(true)
                );
        }

        #endregion

        [Behavior(BehaviorType.PreCombatBuffs, WoWClass.Druid, WoWSpec.DruidFeral, WoWContext.All)]
        public static Composite CreateFeralNormalPreCombatBuffs()
        {
            return new Decorator(
                ret => !Spell.IsCastingOrChannelling() && !Spell.IsGlobalCooldown(),
                new PrioritySelector(
                    // cast cat form if not in combat and moving, but only if not recent shapeshift error
                    new Throttle(10, Spell.BuffSelf("Cat Form", ret => Me.IsMoving && !RecentShapeshiftErrorOccurred)),
                    // cancel form if we get a shapeshift error 
                    new Throttle(5,
                                 new Decorator(
                                     ret =>
                                     !Me.IsMoving && Me.Shapeshift != ShapeshiftForm.Normal &&
                                     TheFinalCallRoutine.IsQuesting && RecentShapeshiftErrorOccurred,
                                     new Action(ret =>
                                         {
                                             string formName = Me.Shapeshift.ToString() + " Form";
                                             Logger.Write(
                                                 "/cancel [{0}] due to shapeshift error and prevent out of combat {1:F0} seconds while Questing",
                                                 formName, (SuppressShapeshiftUntil - DateTime.Now).TotalSeconds);
                                             Me.CancelAura(formName);
                                         })
                                     )
                        )
                    )
                );
        }

        [Behavior(BehaviorType.CombatBuffs, WoWClass.Druid, WoWSpec.DruidFeral, WoWContext.All)]
        public static Composite CreateFeralNormalCombatBuffs()
        {
            return new Decorator(
                ret => !Spell.IsCastingOrChannelling() && !Spell.IsGlobalCooldown(),
                new PrioritySelector(
                    Spell.BuffSelf("Cat Form")
                    )
                );
        }

        [Behavior(BehaviorType.Combat, WoWClass.Druid, WoWSpec.DruidFeral, WoWContext.All)]
        public static Composite CreateFeralNormalCombat()
        {
            return new PrioritySelector(
                Safers.EnsureTarget(),
                Movement.CreateMoveToLosBehavior(),
                Movement.CreateFaceTargetBehavior(),
                Spell.WaitForCast(true),
                new Action(context => resetVariables()),
                new Action(ret =>
                    {
                        _aoeColl = Unit.NearbyUnfriendlyUnits.Where(u => u.Distance2D < 8f);
                        return RunStatus.Failure;
                    }),
                new Decorator(ret => _aoeColl.Count() <= 2,
                              new PrioritySelector(
                                  new Decorator(ret => Common.HasTalent(DruidTalents.DreamOfCenarius), doc()),
                                  new Decorator(ret => !Common.HasTalent(DruidTalents.DreamOfCenarius), nondoc())
                                  )
                    ),
                new Decorator(ret => _aoeColl.Count() > 2, aoe()),
                //doc(),
                Movement.CreateMoveToMeleeBehavior(true)
                );
        }

        private static Composite aoe()
        {
            return new PrioritySelector(
                Common.CreateAutoAttack(false),
                new Decorator(ret => buff.savage_roar.remains <= 1, savage_roar()),
                new Decorator(ret => buff.savage_roar.remains <= 3 && combo_points > 0, savage_roar()),
                new Decorator(ret => buff.tigers_fury.up, Item.UseEquippedItem((uint) WoWEquipSlot.Hands)),
                new Decorator(ret => energy <= 35 && !buff.omen_of_clarity.react, tigers_fury()),
                new Decorator(
                    ret => buff.tigers_fury.up && StyxWoW.Me.CurrentTarget != null && StyxWoW.Me.CurrentTarget.IsBoss,
                    berserk()),
                new Decorator(ret => buff.berserk.up, Item.UseItem(76089)),
                new Decorator(ret => !_aoeColl.Any(m => m.IsCrowdControlled()),
                              new PrioritySelector(
                                  new Decorator(ret => buff.tigers_fury.up && dot.thrash_cat.remains < 9, thrash_cat()),
                                  new Decorator(ret => dot.thrash_cat.remains < 3, thrash_cat()))),
                new Decorator(ret => buff.savage_roar.remains < 9 && combo_points >= 5, savage_roar()),
                new Decorator(ret => combo_points >= 5, rip()),
                new Decorator(ret => _aoeColl.Count() < 8, rake_cycle()),
                new Decorator(ret => !_aoeColl.Any(m => m.IsCrowdControlled()),
                              new PrioritySelector(
                                  new Decorator(ret => buff.savage_roar.remains <= 5, swipe()),
                                  new Decorator(ret => (buff.tigers_fury.up || buff.berserk.up), swipe()),
                                  new Decorator(ret => cooldown.tigers_fury.remains < 3, swipe()),
                                  new Decorator(ret => buff.omen_of_clarity.react, swipe()),
                                  new Decorator(ret => time_to_max <= 1, swipe()))),
                new Decorator(ret => _aoeColl.Any(m => m.IsCrowdControlled()),
                              new PrioritySelector(
                                  new Decorator(ret => Common.HasTalent(DruidTalents.DreamOfCenarius), doc()),
                                  new Decorator(ret => !Common.HasTalent(DruidTalents.DreamOfCenarius), nondoc())
                                  )
                    )
                );
        }

        private static Composite nondoc()
        {
            return new PrioritySelector(
                Common.CreateAutoAttack(false),
                Common.CreateInterruptSpellCast(ret => Me.CurrentTarget),
                berserking(),
                new Decorator(ret => buff.heart_of_the_wild.up, Item.UseEquippedItem((uint) WoWEquipSlot.Hands)),
                new Decorator(ret => Common.HasTalent(DruidTalents.HeartOfTheWild), heart_of_the_wild()),
                new Decorator(ret => buff.heart_of_the_wild.up || target.time_to_die <= 40, Item.UseItem(76089)),
                new Decorator(ret => cast_time < buff.heart_of_the_wild.remains, wrath()),
                new Decorator(ret => buff.cat_form.down, cat_form()),
                new Decorator(ret => buff.savage_roar.down, savage_roar()),
                new Decorator(ret => debuff.weakened_armor.stack < 3, faerie_fire()),
                new Decorator(ret =>
                              Common.HasTalent(DruidTalents.Incarnation) && energy <= 35 && !buff.omen_of_clarity.react &&
                              cooldown.tigers_fury.remains ==
                              0 && cooldown.berserk.remains == 0, incarnation()),
                new Decorator(ret => buff.tigers_fury.up, Item.UseEquippedItem((uint) WoWEquipSlot.Hands)),
                new Decorator(ret => (energy <= 35 && !buff.omen_of_clarity.react) || buff.king_of_the_jungle.up,
                              tigers_fury()),
                new Decorator(
                    ret =>
                    (buff.tigers_fury.up || (target.time_to_die < 15 && cooldown.tigers_fury.remains > 6)) &&
                    StyxWoW.Me.CurrentTarget != null && StyxWoW.Me.CurrentTarget.IsBoss,
                    berserk()),
                new Decorator(ret => Common.HasTalent(DruidTalents.NaturesVigil) && buff.berserk.up, natures_vigil()),
                new Decorator(
                    ret => combo_points >= 1 && dot.rip.ticking && dot.rip.remains <= 2 && target.health.pct <= 25,
                    ferocious_bite()),
                new Decorator(
                    ret => target.time_to_die >= 6 && buff.omen_of_clarity.react && dot.thrash_cat.remains < 3,
                    thrash_cat()),
                new Decorator(ret =>
                              (target.time_to_die <= 4 && combo_points >= 5) ||
                              (target.time_to_die <= 1 && combo_points >= 3),
                              ferocious_bite()),
                new Decorator(ret => buff.savage_roar.remains <= 3 && combo_points > 0 && target.health.pct < 25,
                              savage_roar()),
                new Decorator(ret => (buff.berserk.up && target.health.pct <= 25) || target.time_to_die <= 40,
                              Item.UseItem(76089)),
                new Decorator(ret =>
                              combo_points >= 5 && rip_tick_multiplier/dot.rip.multiplier > 1.14 &&
                              target.health.pct <= 25 &&
                              target.time_to_die > 30, rip()),
                new Decorator(ret => combo_points >= 5 && dot.rip.ticking && target.health.pct <= 25, ferocious_bite()),
                new Decorator(ret =>
                              combo_points >= 5 && target.time_to_die >= 6 && dot.rip.remains < 2.0 &&
                              (buff.berserk.up || dot.rip.remains + 1.9 <= cooldown.tigers_fury.remains), rip()),
                new Decorator(ret =>
                              buff.savage_roar.remains <= 3 && combo_points > 0 &&
                              buff.savage_roar.remains + 2 > (rip_remains),
                              savage_roar()),
                new Decorator(ret => dot.rip.ticking && dot.rip.remains <= 4, filler()),
                new Decorator(ret =>
                              buff.savage_roar.remains <= 6 && combo_points >= 5 &&
                              buff.savage_roar.remains + 2 <= (rip_remains),
                              savage_roar()),
                new Decorator(ret =>
                              combo_points >= 5 && ((rip_remains) > 10 || ((rip_remains) > 6 && buff.berserk.up)) &&
                              dot.rip.ticking, ferocious_bite()),
                new Decorator(
                    ret => target.time_to_die - dot.rake.remains > 3 && rake_tick_multiplier/dot.rake.multiplier > 1.12,
                    rake()),
                new Decorator(ret =>
                              target.time_to_die - dot.rake.remains > 3 && dot.rake.remains < 3.0 &&
                              (buff.berserk.up || (cooldown.tigers_fury.remains + 0.8) >= dot.rake.remains ||
                               energy > 60), rake()),
                new Decorator(ret =>
                              dot.thrash_cat.remains < 3 && target.time_to_die >= 6 &&
                              ((rip_remains) >= 4 || buff.berserk.up),
                              thrash_cat()),
                new Decorator(ret => buff.omen_of_clarity.react, filler()),
                new Decorator(ret =>
                              ((combo_points < 5 && dot.rip.remains < 3.0) ||
                               (combo_points == 0 && buff.savage_roar.remains < 2)),
                              filler()),
                new Decorator(ret => target.time_to_die <= 8.5, filler()),
                new Decorator(ret => (buff.tigers_fury.up || buff.berserk.up || buff.natures_vigil.up), filler()),
                new Decorator(ret => cooldown.tigers_fury.remains <= 3.0, filler()),
                new Decorator(ret => time_to_max <= 1.0, filler()),
                new Decorator(ret => Common.HasTalent(DruidTalents.SoulOfTheForest) && combo_points < 5, filler()),
                new Decorator(ret => Common.HasTalent(DruidTalents.ForceOfNature), treants()),
                new Decorator(
                    ret =>
                    Common.HasTalent(DruidTalents.NaturesSwiftness) && buff.natures_vigil.up && !buff.berserk.up &&
                    !buff.predatory_swiftness.up,
                    natures_swiftness()),
                new Decorator(ret =>
                              buff.natures_vigil.up && (buff.predatory_swiftness.up || buff.natures_swiftness.up) &&
                              !buff.berserk.up, healing_touch())
                );
        }

        private static Composite doc()
        {
            return new PrioritySelector(
                Common.CreateAutoAttack(false),
                Common.CreateInterruptSpellCast(ret => Me.CurrentTarget),
                berserking(),
                new Decorator(ret =>
                              buff.predatory_swiftness.up && buff.predatory_swiftness.remains <= 1.5 &&
                              buff.dream_of_cenarius_damage.down, healing_touch()),
                new Decorator(ret => buff.savage_roar.down, savage_roar()),
                new Decorator(ret => debuff.weakened_armor.stack < 3, faerie_fire()),
                new Decorator(ret =>
                              buff.predatory_swiftness.up &&
                              combo_points >= 4 &&
                              buff.dream_of_cenarius_damage.stack < 2, healing_touch()),
                new Decorator(ret => buff.natures_swiftness.up, healing_touch()),
                new Decorator(ret =>
                              Common.HasTalent(DruidTalents.Incarnation) && energy <= 35 && !buff.omen_of_clarity.react &&
                              cooldown.tigers_fury.remains ==
                              0 && cooldown.berserk.remains == 0, incarnation()),
                new Decorator(ret => buff.tigers_fury.up, Item.UseEquippedItem((uint) WoWEquipSlot.Hands)),
                new Decorator(ret => (energy <= 35 && !buff.omen_of_clarity.react) || buff.king_of_the_jungle.up,
                              tigers_fury()),
                new Decorator(
                    ret =>
                    (buff.tigers_fury.up || (target.time_to_die < 15 && cooldown.tigers_fury.remains > 6)) &&
                    StyxWoW.Me.CurrentTarget != null && StyxWoW.Me.CurrentTarget.IsBoss,
                    berserk()),
                new Decorator(
                    ret => combo_points >= 1 && dot.rip.ticking && dot.rip.remains <= 3 && target.health.pct <= 25,
                    ferocious_bite()),
                new Decorator(
                    ret => target.time_to_die >= 6 && buff.omen_of_clarity.react && dot.thrash_cat.remains < 3,
                    thrash_cat()),
                new Decorator(ret =>
                              (target.time_to_die <= 4 && combo_points >= 5) ||
                              (target.time_to_die <= 1 && combo_points >= 3),
                              ferocious_bite()),
                new Decorator(ret => buff.savage_roar.remains <= 3 && combo_points > 0 && target.health.pct < 25,
                              savage_roar()),
                new Decorator(ret =>
                              Common.HasTalent(DruidTalents.NaturesSwiftness) && buff.dream_of_cenarius_damage.down &&
                              buff.predatory_swiftness.down &&
                              combo_points >= 5 &&
                              target.health.pct <= 25, natures_swiftness()),
                new Decorator(ret =>
                              (combo_points >= 5 && target.health.pct <= 25 && buff.dream_of_cenarius_damage.up) ||
                              target.time_to_die <= 40, Item.UseItem(76089)),
                //TODO HERE   line_cd = 30,
                new Decorator(ret =>
                              combo_points >= 5 && buff.virmens_bite_potion.up && buff.dream_of_cenarius_damage.up &&
                              target.health.pct <= 25 && target.time_to_die > 30, rip()),
                new Decorator(ret =>
                              combo_points >= 5 && rip_tick_multiplier/dot.rip.multiplier > 1.14 &&
                              target.health.pct <= 25 &&
                              target.time_to_die > 30, rip()),
                new Decorator(ret =>
                              combo_points >= 5 && dot.rip.ticking && target.health.pct <= 25 &&
                              ((energy < 50 && buff.berserk.down) || (energy < 25 && buff.berserk.remains > 1)),
                              new ActionAlwaysSucceed()
                    ),
                new Decorator(ret => combo_points >= 5 && dot.rip.ticking && target.health.pct <= 25, ferocious_bite()),
                new Decorator(ret =>
                              combo_points >= 5 && target.time_to_die >= 6 && dot.rip.remains < 2.0 &&
                              buff.dream_of_cenarius_damage.up, rip()),
                new Decorator(ret =>
                              combo_points >= 5 && target.time_to_die >= 6 && dot.rip.remains < 6.0 &&
                              buff.dream_of_cenarius_damage.up && dot.rip.multiplier <= rip_tick_multiplier, rip()),
                new Decorator(ret =>
                              Common.HasTalent(DruidTalents.NaturesSwiftness) && buff.dream_of_cenarius_damage.down &&
                              buff.predatory_swiftness.down &&
                              combo_points >= 5 &&
                              dot.rip.remains < 3 &&
                              (buff.berserk.up || dot.rip.remains + 1.9 <= cooldown.tigers_fury.remains) &&
                              target.health.pct > 25, natures_swiftness()),
                new Decorator(ret =>
                              combo_points >= 5 && target.time_to_die >= 6 && dot.rip.remains < 2.0 &&
                              (buff.berserk.up || dot.rip.remains + 1.9 <= cooldown.tigers_fury.remains), rip()),
                new Decorator(ret =>
                              buff.savage_roar.remains <= 3 && combo_points > 0 &&
                              buff.savage_roar.remains + 2 > dot.rip.remains,
                              savage_roar()),
                new Decorator(ret => dot.rip.ticking && dot.rip.remains <= 4, filler()),
                new Decorator(ret =>
                              buff.savage_roar.remains <= 6 && combo_points >= 5 &&
                              buff.savage_roar.remains + 2 <= (rip_remains),
                              savage_roar()),
                new Decorator(ret =>
                              combo_points >= 5 &&
                              ((energy < 50 && buff.berserk.down) || (energy < 25 && buff.berserk.remains > 1)) &&
                              buff.savage_roar.remains - 6 >= (rip_remains) && (rip_remains) >= 4.5,
                              new ActionAlwaysSucceed()
                    ),
                new Decorator(ret =>
                              combo_points >= 5 &&
                              ((energy < 50 && buff.berserk.down) || (energy < 25 && buff.berserk.remains > 1)) &&
                              buff.savage_roar.remains + 6 >= (rip_remains) && (rip_remains) >= 6.5,
                              new ActionAlwaysSucceed()
                    ),
                new Decorator(
                    ret => combo_points >= 5 && buff.savage_roar.remains - 6 >= (rip_remains) && (rip_remains) >= 4,
                    ferocious_bite()),
                new Decorator(
                    ret => combo_points >= 5 && buff.savage_roar.remains + 6 >= (rip_remains) && (rip_remains) >= 6,
                    ferocious_bite()),
                new Decorator(ret =>
                              combo_points >= 5 &&
                              ((energy < 50 && buff.berserk.down) || (energy < 25 && buff.berserk.remains > 1)) &&
                              (rip_remains) >= 10.5, new ActionAlwaysSucceed()
                    ),
                new Decorator(ret => combo_points >= 5 && (rip_remains) >= 10, ferocious_bite()),
                new Decorator(ret =>
                              target.time_to_die - dot.rake.remains > 3 && dot.rake.remains < 6.0 &&
                              buff.dream_of_cenarius_damage.up && dot.rake.multiplier <= rake_tick_multiplier,
                              rake()),
                new Decorator(
                    ret => target.time_to_die - dot.rake.remains > 3 && rake_tick_multiplier/dot.rake.multiplier > 1.12,
                    rake()),
                new Decorator(ret =>
                              target.time_to_die - dot.rake.remains > 3 && dot.rake.remains < 3.0 &&
                              (buff.berserk.up || (cooldown.tigers_fury.remains + 0.8) >= dot.rake.remains ||
                               energy > 60), rake()),
                new Decorator(ret =>
                              dot.thrash_cat.remains < 3 && target.time_to_die >= 6 &&
                              ((rip_remains) >= 4 || buff.berserk.up),
                              thrash_cat()),
                new Decorator(ret => buff.omen_of_clarity.react, filler()),
                new Decorator(ret =>
                              ((combo_points < 5 && dot.rip.remains < 3.0) ||
                               (combo_points == 0 && buff.savage_roar.remains < 2)),
                              filler()),
                new Decorator(ret => buff.predatory_swiftness.remains > 1, filler()),
                new Decorator(ret => target.time_to_die <= 8.5, filler()),
                new Decorator(ret => (buff.tigers_fury.up || buff.berserk.up || buff.natures_vigil.up), filler()),
                new Decorator(ret => cooldown.tigers_fury.remains <= 3.0, filler()),
                new Decorator(ret => time_to_max <= 1.0, filler()),
                new Decorator(ret => Common.HasTalent(DruidTalents.ForceOfNature), treants())
                );
        }

        private static RunStatus resetVariables()
        {
            _rake_tick_multiplier = null;
            _rip_tick_multiplier = null;
            _rip_remains = null;
            _combo_points = null;
            _energy = null;
            _time_to_max = null;
            _EnergyRegen = null;
            _cast_time = null;
            _debuff_weakened_armor_stack = null;
            _time_to_die = null;
            _pct = null;
            _cooldown_berserk_remains = null;
            _cooldown_tigers_fury_remains = null;
            _dot_rake_remains = null;
            _dot_rip_ticking = null;
            _dot_rip_remains = null;
            _dot_thrash_cat_remains = null;
            _buff_berserk_up = null;
            _buff_berserk_down = null;
            _buff_berserk_remains = null;
            _buff_cat_form_down = null;
            _buff_dream_of_cenarius_damage_down = null;
            _buff_dream_of_cenarius_damage_up = null;
            _buff_dream_of_cenarius_damage_stack = null;
            _buff_heart_of_the_wild_remains = null;
            _buff_heart_of_the_wild_up = null;
            _buff_king_of_the_jungle_up = null;
            _buff_king_of_the_jungle_down = null;
            _buff_natures_swiftness_up = null;
            _buff_natures_vigil_up = null;
            _buff_omen_of_clarity_react = null;
            _buff_predatory_swiftness_up = null;
            _buff_predatory_swiftness_down = null;
            _buff_predatory_swiftness_remains = null;
            _buff_savage_roar_remains = null;
            _buff_savage_roar_down = null;
            _buff_savage_roar_up = null;
            _buff_tigers_fury_up = null;
            _buff_virmens_bite_potion_up = null;
            return RunStatus.Failure;
        }


        private static Composite swipe()
        {
            return Spell.Cast("Swipe");
        }

        private static Composite rake_cycle()
        {
            return new PrioritySelector(
                new Sequence(
                    new Action(ret => a = GetMultiDoTTarget("Rake")),
                    new Decorator(ret => a != null,
                                  new Action(ret => a.Target())),
                    Spell.Cast("Rake", ret => !StyxWoW.Me.CurrentTarget.HasMyAura("Rake"))
                    ));
        }

        private static WoWUnit GetMultiDoTTarget(string debuffs)
        {
            return Me.CurrentTarget != null
                       ? Unit.AttackableMeleeUnits.FirstOrDefault(
                           x =>
                           (x.IsTargetingMyPartyMember || x.IsTargetingMeOrPet || x.IsTargetingAnyMinion ||
                            x.IsTargetingMyRaidMember || x.IsTargetingPet) &&
                           x.GetAuraTimeLeft(debuffs).TotalSeconds < 3)
                       : null;
        }

        private static Composite cat_form()
        {
            return Spell.BuffSelf("Cat Form");
        }

        private static Composite wrath()
        {
            return Spell.Cast("Wrath");
        }

        private static Composite heart_of_the_wild()
        {
            return Spell.BuffSelf("Heart of the Wild");
        }

        private static Composite natures_vigil()
        {
            return Spell.BuffSelf("Nature's Vigil");
        }

        private static Composite treants()
        {
            return Spell.CastOnGround("Force of Nature", ret => StyxWoW.Me.Location, ret => true, false);
        }

        private static Composite rake()
        {
            return Spell.Cast("Rake");
        }

        private static Composite filler()
        {
            return new PrioritySelector(
                new Decorator(ret => dot.thrash_cat.remains < 3 && target.time_to_die >= 6 && combo_points >= 5,
                              thrash_cat()),
                ravage(),
                new Decorator(ret => buff.omen_of_clarity.react && buff.king_of_the_jungle.down, shred()),
                new Decorator(ret => buff.berserk.up && buff.king_of_the_jungle.down, shred()),
                new Decorator(ret => ((combo_points < 5 && dot.rip.remains < 3.0) ||
                                      (combo_points == 0 && buff.savage_roar.remains < 2)) &&
                                     buff.king_of_the_jungle.down, mangle_cat()),
                new Decorator(ret => buff.king_of_the_jungle.down, shred())
                );
        }

        private static Composite mangle_cat()
        {
            return Spell.Cast("Mangle");
        }

        private static Composite shred()
        {
            return new PrioritySelector(
                new Decorator(ret => StyxWoW.Me.Specialization == WoWSpec.DruidGuardian, mangle_cat()),
                new Decorator(ret => StyxWoW.Me.CurrentTarget.MeIsBehind ||
                                     StyxWoW.Me.CurrentTarget.IsShredBoss() ||
                                     TalentManager.HasGlyph("Shred") &&
                                     (StyxWoW.Me.HasAura(5217) ||
                                      StyxWoW.Me.HasAura(106951)), Spell.Cast("Shred")),
                new Decorator(ret => !(StyxWoW.Me.CurrentTarget.MeIsBehind ||
                                       StyxWoW.Me.CurrentTarget.IsShredBoss() ||
                                       TalentManager.HasGlyph("Shred") &&
                                       (StyxWoW.Me.HasAura(5217) ||
                                        StyxWoW.Me.HasAura(106951))), mangle_cat()),
                new ActionAlwaysFail());
        }

        private static Composite ravage()
        {
            return new PrioritySelector(
                new Decorator(ret => (StyxWoW.Me.HasAura("Incarnation: King of the Jungle") ||
                                      (StyxWoW.Me.HasAura("Prowl") &&
                                       StyxWoW.Me.CurrentTarget.MeIsBehind)), Spell.Cast("Ravage")),
                new ActionAlwaysFail()
                );
        }

        private static Composite rip()
        {
            return Spell.Cast("Rip");
        }

        private static Composite natures_swiftness()
        {
            return new PrioritySelector(
                new Decorator(ret => !StyxWoW.Me.HasAura(132158), Spell.BuffSelf("Nature's Swiftness")),
                new ActionAlwaysFail()
                );
        }

        private static Composite thrash_cat()
        {
            return Spell.Cast(106832);
        }

        private static Composite ferocious_bite()
        {
            return new PrioritySelector(
                new Decorator(ret => _combo_points < 1, new ActionAlwaysFail()),
                Spell.Cast("Ferocious Bite")
                );
        }

        private static Composite berserk()
        {
            return Spell.BuffSelf("Berserk");
        }

        private static Composite tigers_fury()
        {
            return Spell.BuffSelf("Tiger's Fury");
        }

        private static Composite incarnation()
        {
            return Spell.BuffSelf("Incarnation");
        }

        private static Composite faerie_fire()
        {
            return Spell.Cast("Faerie Fire");
        }

        private static Composite savage_roar()
        {
            return new PrioritySelector(
                new Decorator(ret => !TalentManager.HasGlyph("Savagery") && StyxWoW.Me.RawComboPoints < 1,
                              new ActionAlwaysFail()),
                Spell.BuffSelf("Savage Roar"));
        }

        private static Composite healing_touch()
        {
            return Spell.BuffSelf("Healing Touch");
        }

        private static Composite berserking()
        {
            return Spell.BuffSelf("Berserking");
        }


        /***********VARIABLES*/ ////////////////
    }

    internal class debuff
    {
        public class weakened_armor
        {
            public static double stack
            {
                get
                {
                    if (!Feral._debuff_weakened_armor_stack.HasValue)
                    {
                        Feral._debuff_weakened_armor_stack = StyxWoW.Me.CurrentTarget.GetAuraStacks("Weakened Armor");
                        return Feral._debuff_weakened_armor_stack.Value;
                    }
                    return Feral._debuff_weakened_armor_stack.Value;
                }
            }
        }
    }

    internal class target
    {
        public static double time_to_die
        {
            get
            {
                if (!Feral._time_to_die.HasValue)
                {
                    Feral._time_to_die = StyxWoW.Me.CurrentTarget.TimeToDeath();
                    return Feral._time_to_die.Value;
                }
                return Feral._time_to_die.Value;
            }
        }

        public class health
        {
            public static double pct
            {
                get
                {
                    if (!Feral._pct.HasValue)
                    {
                        Feral._pct = StyxWoW.Me.CurrentTarget.HealthPercent;
                        return Feral._pct.Value;
                    }
                    return Feral._pct.Value;
                }
            }
        }
    }

    internal class cooldown
    {
        public class berserk
        {
            public static double remains
            {
                get
                {
                    if (!Feral._cooldown_berserk_remains.HasValue)
                    {
                        if (!SpellManager.HasSpell("Berserk"))
                            return 0;
                        Feral._cooldown_berserk_remains = SpellManager.Spells["Berserk"].CooldownTimeLeft.TotalSeconds;
                        return Feral._cooldown_berserk_remains.Value;
                    }
                    return Feral._cooldown_berserk_remains.Value;
                }
            }
        }

        public class tigers_fury
        {
            public static double remains
            {
                get
                {
                    if (!Feral._cooldown_tigers_fury_remains.HasValue)
                    {
                        if (!SpellManager.HasSpell("Tiger's Fury"))
                            return 0;
                        Feral._cooldown_tigers_fury_remains =
                            SpellManager.Spells["Tiger's Fury"].CooldownTimeLeft.TotalSeconds;
                        return Feral._cooldown_tigers_fury_remains.Value;
                    }
                    return Feral._cooldown_tigers_fury_remains.Value;
                }
            }
        }
    }

    internal class dot
    {
        public class rake
        {
            public static double remains
            {
                get
                {
                    if (!Feral._dot_rake_remains.HasValue)
                    {
                        Feral._dot_rake_remains = StyxWoW.Me.CurrentTarget.GetAuraTimeLeft("Rake").TotalSeconds;
                        return Feral._dot_rake_remains.Value;
                    }
                    return Feral._dot_rake_remains.Value;
                }
            }

            public static double multiplier
            {
                get { return Feral._dot_rake_multiplier; }
            }
        }

        public class rip
        {
            public static bool ticking
            {
                get
                {
                    if (!Feral._dot_rip_ticking.HasValue)
                    {
                        Feral._dot_rip_ticking = StyxWoW.Me.CurrentTarget.HasMyAura("Rip");
                        return Feral._dot_rip_ticking.Value;
                    }
                    return Feral._dot_rip_ticking.Value;
                }
            }

            public static double remains
            {
                get
                {
                    if (!Feral._dot_rip_remains.HasValue)
                    {
                        Feral._dot_rip_remains = StyxWoW.Me.CurrentTarget.GetAuraTimeLeft("Rip").TotalSeconds;
                        return Feral._dot_rip_remains.Value;
                    }
                    return Feral._dot_rip_remains.Value;
                }
            }

            public static double multiplier
            {
                get { return Feral._dot_rip_multiplier; }
            }
        }

        public class thrash_cat
        {
            public static double remains
            {
                get
                {
                    if (!Feral._dot_thrash_cat_remains.HasValue)
                    {
                        Feral._dot_thrash_cat_remains = StyxWoW.Me.CurrentTarget.GetAuraTimeLeft("Thrash").TotalSeconds;
                        return Feral._dot_thrash_cat_remains.Value;
                    }
                    return Feral._dot_thrash_cat_remains.Value;
                }
            }
        }
    }

    /***** HERE WE GO*/ /////////

    internal class buff
    {
        public class berserk
        {
            public static bool up
            {
                get
                {
                    if (!Feral._buff_berserk_up.HasValue)
                    {
                        Feral._buff_berserk_up = StyxWoW.Me.HasAura(106951);
                        return Feral._buff_berserk_up.Value;
                    }
                    return Feral._buff_berserk_up.Value;
                }
            }

            public static bool down
            {
                get
                {
                    if (!Feral._buff_berserk_down.HasValue)
                    {
                        Feral._buff_berserk_down = !StyxWoW.Me.HasAura(106951);
                        return Feral._buff_berserk_down.Value;
                    }
                    return Feral._buff_berserk_down.Value;
                }
            }

            public static double remains
            {
                get
                {
                    if (!Feral._buff_berserk_remains.HasValue)
                    {
                        Feral._buff_berserk_remains = StyxWoW.Me.GetAuraTimeLeft(106951).TotalSeconds;
                        return Feral._buff_berserk_remains.Value;
                    }
                    return Feral._buff_berserk_remains.Value;
                }
            }
        }

        public class cat_form
        {
            public static bool down
            {
                get
                {
                    if (!Feral._buff_cat_form_down.HasValue)
                    {
                        Feral._buff_cat_form_down = StyxWoW.Me.Shapeshift != ShapeshiftForm.Cat;
                        return Feral._buff_cat_form_down.Value;
                    }
                    return Feral._buff_cat_form_down.Value;
                }
            }
        }

        public class dream_of_cenarius_damage
        {
            public static bool down
            {
                get
                {
                    if (!Feral._buff_dream_of_cenarius_damage_down.HasValue)
                    {
                        Feral._buff_dream_of_cenarius_damage_down = !StyxWoW.Me.HasAura(108381);
                        return Feral._buff_dream_of_cenarius_damage_down.Value;
                    }
                    return Feral._buff_dream_of_cenarius_damage_down.Value;
                }
            }

            public static double stack
            {
                get
                {
                    if (!Feral._buff_dream_of_cenarius_damage_stack.HasValue)
                    {
                        Feral._buff_dream_of_cenarius_damage_stack = StyxWoW.Me.GetAuraStacks(108381);
                        return Feral._buff_dream_of_cenarius_damage_stack.Value;
                    }
                    return Feral._buff_dream_of_cenarius_damage_stack.Value;
                }
            }

            public static bool up
            {
                get
                {
                    if (!Feral._buff_dream_of_cenarius_damage_up.HasValue)
                    {
                        Feral._buff_dream_of_cenarius_damage_up = StyxWoW.Me.HasAura(108381);
                        return Feral._buff_dream_of_cenarius_damage_up.Value;
                    }
                    return Feral._buff_dream_of_cenarius_damage_up.Value;
                }
            }
        }

        public class heart_of_the_wild
        {
            public static bool up
            {
                get
                {
                    if (!Feral._buff_heart_of_the_wild_up.HasValue)
                    {
                        Feral._buff_heart_of_the_wild_up = StyxWoW.Me.HasAura(108292);
                        return Feral._buff_heart_of_the_wild_up.Value;
                    }
                    return Feral._buff_heart_of_the_wild_up.Value;
                }
            }

            public static double remains
            {
                get
                {
                    if (!Feral._buff_heart_of_the_wild_remains.HasValue)
                    {
                        Feral._buff_heart_of_the_wild_remains = StyxWoW.Me.GetAuraTimeLeft(108292).TotalSeconds;
                        return Feral._buff_heart_of_the_wild_remains.Value;
                    }
                    return Feral._buff_heart_of_the_wild_remains.Value;
                }
            }
        }

        public class king_of_the_jungle
        {
            public static bool up
            {
                get
                {
                    if (!Feral._buff_king_of_the_jungle_up.HasValue)
                    {
                        Feral._buff_king_of_the_jungle_up = StyxWoW.Me.HasAura("Incarnation: King of the Jungle");
                        return Feral._buff_king_of_the_jungle_up.Value;
                    }
                    return Feral._buff_king_of_the_jungle_up.Value;
                }
            }

            public static bool down
            {
                get
                {
                    if (!Feral._buff_king_of_the_jungle_down.HasValue)
                    {
                        Feral._buff_king_of_the_jungle_down = !StyxWoW.Me.HasAura("Incarnation: King of the Jungle");
                        return Feral._buff_king_of_the_jungle_down.Value;
                    }
                    return Feral._buff_king_of_the_jungle_down.Value;
                }
            }
        }

        public class natures_swiftness
        {
            public static bool up
            {
                get
                {
                    if (!Feral._buff_natures_swiftness_up.HasValue)
                    {
                        Feral._buff_natures_swiftness_up = StyxWoW.Me.HasAura(132158);
                        return Feral._buff_natures_swiftness_up.Value;
                    }
                    return Feral._buff_natures_swiftness_up.Value;
                }
            }
        }

        public class natures_vigil
        {
            public static bool up
            {
                get
                {
                    if (!Feral._buff_natures_vigil_up.HasValue)
                    {
                        Feral._buff_natures_vigil_up = StyxWoW.Me.HasAura(124974);
                        return Feral._buff_natures_vigil_up.Value;
                    }
                    return Feral._buff_natures_vigil_up.Value;
                }
            }
        }

        public class omen_of_clarity
        {
            public static bool react
            {
                get
                {
                    if (!Feral._buff_omen_of_clarity_react.HasValue)
                    {
                        Feral._buff_omen_of_clarity_react = StyxWoW.Me.HasAura(135700);
                        return Feral._buff_omen_of_clarity_react.Value;
                    }
                    return Feral._buff_omen_of_clarity_react.Value;
                }
            }
        }

        public class predatory_swiftness
        {
            public static bool up
            {
                get
                {
                    if (!Feral._buff_predatory_swiftness_up.HasValue)
                    {
                        Feral._buff_predatory_swiftness_up = StyxWoW.Me.HasAura(69369);
                        return Feral._buff_predatory_swiftness_up.Value;
                    }
                    return Feral._buff_predatory_swiftness_up.Value;
                }
            }

            public static double remains
            {
                get
                {
                    if (!Feral._buff_predatory_swiftness_remains.HasValue)
                    {
                        Feral._buff_predatory_swiftness_remains = StyxWoW.Me.GetAuraTimeLeft(69369).TotalSeconds;
                        return Feral._buff_predatory_swiftness_remains.Value;
                    }
                    return Feral._buff_predatory_swiftness_remains.Value;
                }
            }

            public static bool down
            {
                get
                {
                    if (!Feral._buff_predatory_swiftness_down.HasValue)
                    {
                        Feral._buff_predatory_swiftness_down = !StyxWoW.Me.HasAura(69369);
                        return Feral._buff_predatory_swiftness_down.Value;
                    }
                    return Feral._buff_predatory_swiftness_down.Value;
                }
            }
        }

        public class savage_roar
        {
            public static double remains
            {
                get
                {
                    if (!Feral._buff_savage_roar_remains.HasValue)
                    {
                        Feral._buff_savage_roar_remains = TalentManager.HasGlyph("Savagery")
                                                              ? StyxWoW.Me.GetAuraTimeLeft(127538).TotalSeconds
                                                              : StyxWoW.Me.GetAuraTimeLeft(52610).TotalSeconds;
                        return Feral._buff_savage_roar_remains.Value;
                    }
                    return Feral._buff_savage_roar_remains.Value;
                }
            }

            public static bool down
            {
                get
                {
                    if (!Feral._buff_savage_roar_down.HasValue)
                    {
                        Feral._buff_savage_roar_down = TalentManager.HasGlyph("Savagery")
                                                           ? !StyxWoW.Me.HasAura(127538)
                                                           : !StyxWoW.Me.HasAura(52610);
                        return Feral._buff_savage_roar_down.Value;
                    }
                    return Feral._buff_savage_roar_down.Value;
                }
            }

            public static bool up
            {
                get
                {
                    if (!Feral._buff_savage_roar_up.HasValue)
                    {
                        Feral._buff_savage_roar_up = TalentManager.HasGlyph("Savagery")
                                                         ? StyxWoW.Me.HasAura(127538)
                                                         : StyxWoW.Me.HasAura(52610);
                        return Feral._buff_savage_roar_up.Value;
                    }
                    return Feral._buff_savage_roar_up.Value;
                }
            }
        }

        public class tigers_fury
        {
            public static bool up
            {
                get
                {
                    if (!Feral._buff_tigers_fury_up.HasValue)
                    {
                        Feral._buff_tigers_fury_up = StyxWoW.Me.HasAura(5217);
                        return Feral._buff_tigers_fury_up.Value;
                    }
                    return Feral._buff_tigers_fury_up.Value;
                }
            }
        }

        public class virmens_bite_potion
        {
            public static bool up
            {
                get
                {
                    if (!Feral._buff_virmens_bite_potion_up.HasValue)
                    {
                        Feral._buff_virmens_bite_potion_up = StyxWoW.Me.HasAura(105697);
                        return Feral._buff_virmens_bite_potion_up.Value;
                    }
                    return Feral._buff_virmens_bite_potion_up.Value;
                }
            }
        }
    }
}